﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>添加用户 - QAdmin后台模板</title>
    <link rel="stylesheet" href="~/static/common/layui/css/layui.css">
    <link rel="stylesheet" href="~/static/admin/css/style.css">

    <script src="~/static/common/layui/layui.js"></script>
    <script src="~/static/common/jquery-3.3.1.min.js"></script>
    <script src="~/static/common/vue.min.js"></script>
    <script src="~/static/admin/js/config.js"></script>
    <script src="~/static/admin/js/script.js"></script>
</head>
<body>
    <div class="right">
        <fieldset class="layui-elem-field layui-field-title">
            <legend>添加用户</legend>
        </fieldset>
        <div class="layui-form">
            <div class="layui-form-item">
                <label class="layui-form-label">酒店名称</label>
                <div class="layui-input-block">
                    <input type="text" name="HotelName" id="HotelName" required lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">酒店地址</label>
                <div class="layui-input-block">
                    <input type="text" name="HotelAddress" id="HotelAddress" required lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">目的地</label>
                <div class="layui-input-block">
                    <input type="text" name="EndPlace" id="EndPlace" required lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item" id="isvip">
                <label class="layui-form-label">入住时间</label>
                <div class="layui-input-block">
                    <input type="text" id="IntoTime" name="IntoTime" required lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item" id="VipTime">
                <label class="layui-form-label">退房时间</label>
                <div class="layui-input-block">
                    <input type="text" name="OutTime" id="OutTime" required lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">酒店类型</label>
                <div class="layui-input-block">
                    <input type="text" name="TotelType" id="TotelType" required lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">房数</label>
                <div class="layui-input-block">
                    <input type="text" name="NumberOfRooms" id="NumberOfRooms" required lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">人数</label>
                <div class="layui-input-block">
                    <input type="text" id="NumberOfPeople" name="NumberOfPeople" required lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">价格</label>
                <div class="layui-input-block">
                    <input type="text" name="Price" id="Price" required lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">酒店级别</label>
                <div class="layui-input-block">
                    <input type="text" name="Level" id="Level" required lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">酒店描述</label>
                <div class="layui-input-block">
                    <input type="text" name="Describe" id="Describe" required lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <input type="button" id="commit" value="立即提交" class="layui-btn">
                </div>
            </div>
        </div>
    </div>
</body>
</html>
<script>
    //添加
    $("#commit").click(function () {
        var hotel = {};
        hotel.HotelName = $("#HotelName").val();
        hotel.HotelAddress = $("#HotelAddress").val();
        hotel.EndPlace = $("#EndPlace").val();
        hotel.IntoTime = $("#IntoTime").val();
        hotel.OutTime = $("#OutTime").val();
        hotel.TotelType = $("#TotelType").val();
        hotel.NumberOfRooms = $("#NumberOfRooms").val();
        hotel.NumberOfPeople = $("#NumberOfPeople").val();
        hotel.Price = $("#Price").val();
        hotel.Level = $("#Level").val();
        hotel.Describe = $("#Describe").val();

        $.ajax({
            type: "post",
            data: hotel,
            url: "/Hotel/AddHotel",
            success: function (result) {
                if (result.Success) {
                    layer.msg('添加成功！', {
                        title: '提示框',
                        icon: 1,
                        time: 2000
                    }
                        , function () { window.location.reload() });
                } else {
                    layer.alert('添加失败！', {
                        title: '提示框',
                        icon: 1,
                    });
                }
            },
        });
    });
</script>